home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / turbovis / tvmagic1.zip / DLGTEST.PAS < prev    next >
Pascal/Delphi Source File  |  1993-06-10  |  4KB  |  129 lines

  1. uses      App,Objects,Drivers,Dialogs,MagicDlg,Views;
  2.  
  3. { Hint: Press ALT-I in the first dialogbox and CTRL-O in the next one }
  4.  
  5. type      PMovingAboutBox=^TMovingAboutBox;
  6.           TMovingAboutBox=object(TMovingMagicDialog)
  7.                                  function  GetNormalText(i:word):string;virtual;
  8.                                  function  GetMagicText(i:word):string;virtual;
  9.                                  function  NumberOfLines:word;virtual;
  10.                                  function  FreeLines:word;virtual;
  11.                                end;
  12.           PStaticAboutBox=^TStaticAboutBox;
  13.           TStaticAboutBox=object(TStaticMagicDialog)
  14.                                  function  GetNormalText(i:word):string;virtual;
  15.                                  function  GetMagicText(i:word):string;virtual;
  16.                                  function  NumberOfLines:word;virtual;
  17.                                  function  FreeLines:word;virtual;
  18.                                end;
  19.  
  20.  
  21. function  TMovingAboutBox.GetMagicText(i:word):string;
  22. const     text:array[0..17] of string=
  23.                 ('',
  24.                  '',
  25.                  '',
  26.                  '  Hi! I''m a magic dialogbox-virus   ',
  27.                  '    Copy me in your applications     ',
  28.                  '      and join in! (c) MavEtJu       ',
  29.                  '',
  30.                  ' If you like this kind of dialogboxes',
  31.                  ' and will continue to use this unit, ',
  32.                  '    would you be so nice to send a   ',
  33.                  '          postcard from your         ',
  34.                  '        town/city/metropole to       ',
  35.                  '',
  36.                  '          Edwin Groothuis            ',
  37.                  '        Johann Strausslaan 1         ',
  38.                  '        5583ZA Aalst-Waalre          ',
  39.                  '          The Netherlands            ',
  40.                  '.');
  41. begin
  42.   if i>=NumberOfLines then
  43.     GetMagicText:=''
  44.   else
  45.     GetMagicText:=text[i];
  46. end;
  47. function  TMovingAboutBox.GetNormalText(i:word):string;
  48. const     text:array[0..3] of string=
  49.                 ('MavEtJu presents: The Magic Dialogs',
  50.                  '',
  51.                  '   Press Control-O for the show!   ',
  52.                  '');
  53. begin
  54.   if i>=FreeLines then
  55.     GetNormalText:=''
  56.   else
  57.     GetNormalText:=text[i];
  58. end;
  59. function  TMovingAboutBox.NumberOfLines:word;
  60. begin
  61.   NumberOfLines:=18;
  62. end;
  63. function  TMovingAboutBox.FreeLines:word;
  64. begin
  65.   FreeLines:=4;
  66. end;
  67.  
  68.  
  69.  
  70. function  TStaticAboutBox.GetMagicText(i:word):string;
  71. const     text:array[0..3] of string=
  72.                 ('  Hi! I''m a magic dialogbox-virus   ',
  73.                  '    Copy me in your applications     ',
  74.                  '            and join in!             ',
  75.                  '            (c) MavEtJu              ');
  76. begin
  77.   if i>=NumberOfLines then
  78.     GetMagicText:=''
  79.   else
  80.     GetMagicText:=text[i];
  81. end;
  82. function  TStaticAboutBox.GetNormalText(i:word):string;
  83. const     text:array[0..3] of string=
  84.                 ('MavEtJu presents: The Magic Dialogs',
  85.                  '',
  86.                  '     Press ALT-I for the show!     ',
  87.                  '');
  88. begin
  89.   if i>=FreeLines then
  90.     GetNormalText:=''
  91.   else
  92.     GetNormalText:=text[i];
  93. end;
  94. function  TStaticAboutBox.NumberOfLines:word;
  95. begin
  96.   NumberOfLines:=4;
  97. end;
  98. function  TStaticAboutBox.FreeLines:word;
  99. begin
  100.   FreeLines:=4;
  101. end;
  102.  
  103.  
  104.  
  105.  
  106. var       A:TApplication;
  107.           DS:PStaticAboutBox;
  108.           DM:PMovingAboutBox;
  109.           R:TRect;
  110. begin
  111.   A.Init;
  112.  
  113.   R.Assign(1,1,40,10);
  114.   DS:=New(PStaticAboutBox,Init(R,'Static Magic Dialog',GetAltCode('I')));
  115.   R.Assign(10,6,30,8);
  116.   DS^.Insert(New(PButton,Init(R,'Ok',cmOk,bfDefault)));
  117.   DeskTop^.ExecView(DS);
  118.   Dispose(DS,Done);
  119.  
  120.   R.Assign(1,1,40,10);
  121.   DM:=New(PMovingAboutBox,Init(R,'Moving Magic Dialog',GetCtrlCode('O')));
  122.   R.Assign(10,6,30,8);
  123.   DM^.Insert(New(PButton,Init(R,'Ok',cmOk,bfDefault)));
  124.   DeskTop^.ExecView(DM);
  125.   Dispose(DM,Done);
  126.  
  127.   A.Run;
  128.   A.Done;
  129. end.